package com.k2091.washcar.service.impl;

import com.k2091.washcar.entity.Cleaner;
import com.k2091.washcar.entity.Examine;
import com.k2091.washcar.entity.FormInline;
import com.k2091.washcar.mapper.CleanerMapper;
import com.k2091.washcar.mapper.ExamineMapper;
import com.k2091.washcar.service.ICleanerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author author
 * @since 2021-06-01
 */
@Service
public class CleanerServiceImpl extends ServiceImpl<CleanerMapper, Cleaner> implements ICleanerService {


    @Autowired
    private CleanerMapper cleanerMapper;

    @Autowired
    private ExamineMapper examineMapper;

    @Override
    public int insert(Examine examine){
        return examineMapper.insert(examine);
    }

    @Override
    public List<Cleaner> selectCleaner(FormInline formInline) {
        return cleanerMapper.selectCleaner(formInline);
    }

    @Override
    public void upCleanerStatus(@Param("id")Long id, @Param("status")int status, @Param("token")String token) {
        cleanerMapper.upCleanerStatus(id,status,token);
    }

    @Override
    public void deleteCleaner(Long id) {
        cleanerMapper.deleteById(id);
    }

    @Override
    public int createrCleaner(Cleaner cleaner) {
        return cleanerMapper.insert(cleaner);
    }

    @Override
    public int upCleaner(Cleaner cleaner) {
        return cleanerMapper.updateById(cleaner);
    }

    @Override
    public Cleaner selectById(Long id) {
        return cleanerMapper.selectById(id);
    }
}
